<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
$tabs=array(
	array('op'=>'list','title'=>'分享员'),
);
//分享员
if($_RQ['op']=='list'){
	$params=array('uniacid'=>$_SESSION['uniacid']);
	if(!empty($_RQ['nickname'])){
		$params['nickname like']='%'.trim($_RQ['nickname']).'%';
		$return['params']['nickname']=$_RQ['nickname'];
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$list=pdo_getslice('jy_qqdian_sharer',$params,array($pindex,$psize),$total,$fields,'','bind_time desc');
	if($list){
		foreach($list as &$item){

		}
	}	
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'tabs'=>$tabs,
		'list'=>array('data'=>'list','edit'=>false,'del_one'=>false,'delall'=>false,'list'=>array(
			array('name'=>'mid','title'=>'MID','type'=>'string'),
			array('name'=>'nickname','title'=>'昵称','type'=>'string'),
			array('name'=>'openid','title'=>'openid','type'=>'string'),
			array('name'=>'appid','title'=>'绑定小店ID','type'=>'string'),
			array('name'=>'sharer_type','title'=>'类型','type'=>'radio','options'=>'sharer_type'),
			array('name'=>'bind_time','title'=>'绑定时间','type'=>'string'),
		),'batch'=>array(
			array('type'=>'post','url'=>'/sharer.list/updata/','title'=>'同步分享员'),
		)),
		'search'=>array(
			array('name'=>'nickname','width'=>'10','title'=>'分享员名称','type'=>'string'),
			array('name'=>'sharer_type','width'=>'10','title'=>'类型','type'=>'radio','options'=>'sharer_type'),
		)
	);
	$return['htmls']=$htmls;
	$return['share_scene']=$this->share_scene;
	$return['sharer_type']=$this->sharer_type;
	exi($return);
}
if($_RQ['op']=='updata'){
	$this->model('sharer')->upsharer();
	exi('同步分享员成功！');
}